package fr.generali.accueilclient.gwt.client.dispatch;

import net.customware.gwt.dispatch.shared.Action;
import net.customware.gwt.dispatch.shared.Result;

import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * Attention ! Vous ne pouvez pas injecter via GIN un DispatchAsync car ce
 * dernier dépend du premier.
 */
public interface ActionExceptionHandler {

    public enum Status {
        STOP, CONTINUE
    }

    /**
     * This method is called when an exception occurs. Return
     * {@link Status#STOP} to indicate that the exception has been handled and
     * further processing should not occur. Return {@link Status#CONTINUE} to
     * indicate that further processing should occur.
     * 
     * @param e The exception.
     * @return The status after execution.
     */

    <A extends Action<R>, R extends Result> Status onFailure(A action, Throwable caught, final AsyncCallback<R> callback);
}
